<template>


	<view class="content">

		<uni-list>
			<uni-list-item  clickable  showArrow title="修改手机号" @click="toChangeMobile" />
			<uni-list-item  clickable showArrow title="修改密码" @click="toChangePwd"/>
			<uni-list-item clickable showArrow title="注销账户" @click="toDeleteAccount" />
			<uni-list-item clickable showArrow title="检查更新" :rightText="version" @click="onAPPUpdate" />
		</uni-list>
		
		<view class="button-container">
			<button type="warn" class="button" @click="handleLogout">退出登录</button>
		
		</view>
	</view>

</template>

<script>
  // #ifdef APP-PLUS
  import APPUpdate, { getCurrentNo } from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
  // #endif
import authMixin from '@/mixin/auth.js'
	export default {
		data() {
			return {
				windowHeight: uni.getSystemInfoSync().windowHeight,
				version: "" // 版本号
			}
		},
    mixins: [authMixin],
		onLoad(){
			// #ifdef APP-PLUS
			getCurrentNo(res => {
				// 进页面获取当前APP版本号（用于页面显示）
				this.version = res.versionName;
			});
			// #endif
		},
		methods: {
			// 检查APP是否有新版本
			onAPPUpdate() {
				// true 没有新版本的时候有提示，默认：false
				APPUpdate(true);
			},
			toChangePwd() {
				console.log('1')
				uni.navigateTo({
					url:"/pages/mine/change-pwd/change-pwd"
				})
			},
			toDeleteAccount() {
				console.log('2')
				uni.navigateTo({
					url:"/pages/mine/delete-account/delete-account"
				})
				
			},
			toChangeMobile() {
				console.log('3')
				uni.navigateTo({
					url:"/pages/mine/change-mobile/change-mobile"
				})
			},
			handleLogout() {
				this.$modal.confirm('确定注销并退出系统吗？').then(() => {
					this.$store.dispatch('LogOut').then(() => {
						// this.$tab.reLaunch('/pages/home/index')
            uni.reLaunch({ url: '/pages/login' })
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #f8f8f8;
	}
	.content {
		height: 100%;
		padding-bottom: calc(var(--window-bottom) + 20px);
	
	}
	::v-deep .uni-list-item {
		height:100rpx
	}
	
	.button-container {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 0 20rpx;
		margin-bottom: 40rpx;
		height: 50px;
	}
	
	.button {
		flex:1;
		margin-right: 10px;
		margin-left: 10px;
		
		height: 100%;
		text-align: center;
		line-height: 50px;
		font-size: 16px;
		border-radius: 5px;
	
		color: #fff;
	
	
	}
</style>